package edu.stu.cs.software.family.base.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import edu.stu.cs.software.family.base.domain.BaseEntity;

/**
 * This class is the base class for all interfaces
 * @author Administrator
 *
 * @param <T> a type variable
 * @param <LG> the primary key for that type
 */

public interface GenericManager<T extends BaseEntity<LG>, LG extends Serializable> {
	/**
	 * delete entity according given id
	 * @param id entity id
	 */
	public void delete(LG id);
	/**
	 * Deletes all attributes of the entity class
	 */
	public void deleteAll();
	
	/**
	 * Delete the user by ID multiple selection
	 * @param ids
	 */
	public void deleteMore(LG[] ids);
	/**
	 * find by entity of id
	 * @param id
	 * @return
	 */
	public T findById(LG id);
	/**
	 * save specified entity;
	 * @param entity,save specified entity;
	 * @return saved domain entity
	 */	 
	public T save(T entity);
	/**
	 * find by entity of userName
	 * @param name
	 * @param pageable
	 * @return
	 */
	//public Page<T> findByName(String name,Pageable pageable);
	/**
	 * fetch all entities
	 *
	 * @return list for all entities
	 */
	public List<T> findAll();
	/**
	 * 
	 * @param page pagable structure
	 * @return pagable list
	 */
	public Page<T> findAll(Pageable page);
	/**
	 * 
	 * Iterable entity save
	 * @param entities
	 * @return
	 */
	public Iterable<T> save(Iterable<T> entities);
	/**
	 * 
	 * @return The total number of attributes
	 */
	public long count();
	
}
